<template>
  <div class="about">
      <div class="form-group">
        <label>用户名</label>
        <input type="text" class="form-control" v-model='userName'>
      </div>
      <div class="form-group">
        <label>密码</label>
        <input type="password" class="form-control" v-model="psw">
      </div>
      <div class="form-group">
        <button class="btn btn-block btn-primary" @click="loginSub">登陆</button>
      </div>
  </div>
</template>
<script>
import {login} from '../services/member'
export default {
  name:'About',
  data () {
    return {
      userName:'',
      psw:''
    }
  },
  methods: {
    loginSub(){
      if(this.userName === ''){
        alert('密码不能为空')
      }
      if(this.psw === ''){
        alert('密码不能为空')
        return;
      }
      login({
        userName:this.userName,
        psw:this.psw
      }).then((res)=>{
        alert(res.data.msg)
      })
    }
  }

}

</script>
